Skip to content

Add vendored code-review command and security hardening#65

Merged
boneskull merged 1 commit into
mainfrom
claude/address-review-comments-KYtOA
Apr 8, 2026
Merged

Add vendored code-review command and security hardening#65
boneskull merged 1 commit into
mainfrom
claude/address-review-comments-KYtOA

Conversation

@boneskull
Copy link
Copy Markdown
Owner

Summary

This PR adds a vendored code-review command to the repository and updates the Claude Code Review workflow to use it directly instead of relying on external plugins. It also includes security hardening improvements to the GitHub Actions workflows.

Key Changes

  • Added .claude/commands/code-review.md: A comprehensive code review command that provides detailed instructions for reviewing pull requests, including:

    • Pre-flight checks (closed PRs, drafts, already reviewed)
    • CLAUDE.md compliance auditing
    • Parallel bug detection using multiple agents
    • Issue validation and filtering
    • Inline comment posting with high-signal issues only
  • Updated .github/workflows/claude-code-review.yml:

    • Removed dependency on external plugin marketplace (claude-code-plugins)
    • Changed to use the vendored code-review command via /project:code-review prompt
    • Added --comment flag to enable automatic inline commenting
    • Removed labeled trigger type (now only triggers on opened, synchronize, ready_for_review, reopened)
    • Added Harden-Runner step for security hardening with audit egress policy
  • Updated .github/workflows/claude.yml:

    • Added clarifying comment about author_association behavior for issues:edited events
    • Removed TODO comment from contents: read permission (now clear it's needed)

Notable Implementation Details

The code-review command implements a multi-stage review process:

  1. Pre-flight validation to skip unnecessary reviews
  2. Parallel CLAUDE.md compliance checks
  3. Parallel bug detection by multiple agents
  4. Validation of flagged issues to reduce false positives
  5. Selective inline commenting only for high-signal issues

The workflow now uses a vendored approach, eliminating external plugin dependencies and improving reliability and maintainability.

https://claude.ai/code/session_016ujbvPfQnhK55bd2hQFBYd

- Remove 'labeled' trigger type from code-review workflow (all PRs reviewed)
- Add step-security/harden-runner to code-review workflow
- Vendor code-review skill to .claude/commands/ to avoid unpinned git URL
- Remove stale TODO comment on contents:read permission
- Document actor vs. author mismatch for issues:edited trigger

https://claude.ai/code/session_016ujbvPfQnhK55bd2hQFBYd
Copilot AI review requested due to automatic review settings April 8, 2026 01:31
@boneskull boneskull merged commit bccc2d2 into main Apr 8, 2026
10 of 11 checks passed
@boneskull boneskull deleted the claude/address-review-comments-KYtOA branch April 8, 2026 01:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR vendors a code-review command into the repo and updates the Claude Code Review GitHub Actions workflow to use the vendored command (instead of external plugin marketplaces), along with adding runner hardening steps to Claude-related workflows.

Changes:

  • Added a vendored Claude command at .claude/commands/code-review.md to drive PR reviews (including optional inline commenting).
  • Updated claude-code-review workflow to invoke /project:code-review directly and removed plugin marketplace configuration.
  • Hardened Claude workflows by adding step-security/harden-runner and clarified permissions/comments.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
.github/workflows/claude.yml Adds runner hardening and a note about author_association behavior; adjusts permissions comment.
.github/workflows/claude-code-review.yml Switches from external plugins to the vendored /project:code-review command; adds runner hardening; updates triggers.
.claude/commands/code-review.md Introduces a vendored multi-stage code review command definition and procedure.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +28 to +31
# NOTE: For issues:edited, author_association refers to the issue author, not
# the actor who performed the edit. This means an edit by a non-collaborator
# could re-trigger Claude if the original author is a collaborator. In practice,
# only users with write access can edit others' issues, so the risk is limited.
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The NOTE block is inside the multi-line if: | expression, so the # ... lines become part of the GitHub Actions expression string. GitHub expression syntax doesn’t support # comments, which will cause the workflow to fail to parse. Move this note outside the if block (as YAML comments above the if: key) or encode it in a way that doesn’t become part of the expression.

Copilot uses AI. Check for mistakes.
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
# or https://code.claude.com/docs/en/cli-reference for available options
# Uses vendored code-review skill from .claude/commands/code-review.md
prompt: '/project:code-review --comment ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The vendored command instructions use gh pr view <PR> / gh pr diff <PR>, but the workflow passes ${{ github.repository }}/pull/${{ github.event.pull_request.number }} (no scheme). gh pr view accepts a PR number in the current repo, OWNER/REPO#NUMBER, or a full URL; owner/repo/pull/123 is not a standard selector and is likely to fail. Consider passing just the PR number (since the repo is checked out) or a full https://github.com/.../pull/... URL.

Suggested change
prompt: '/project:code-review --comment ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
prompt: '/project:code-review --comment ${{ github.event.pull_request.number }}'

Copilot uses AI. Check for mistakes.

If any condition is true, stop and do not proceed.

Note: Still review Claude generated PR's.
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor grammar: “PR's” should be “PRs” (no apostrophe for plural).

Suggested change
Note: Still review Claude generated PR's.
Note: Still review Claude generated PRs.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants